<?php
//获取传入的参数信息
$u1=$_GET['u1'];
$img1=$_GET['img'];
$name1=$_GET['name1'];
$p1=$_GET['p1'];
$n1=$_GET['n1'];
$s1=$_GET['s1'];
$x1=$_GET['xzk'];

//连接数据库
$link=mysqli_connect("localhost",'root','','shop');
//设置编码
mysqli_set_charset($link,"utf8");
//SQL语句
$sql1="select * from $u1 where name='$name1' AND size='$s1'";
//执行SQL语句
$result1=mysqli_query($link,$sql1);
if(($row=mysqli_fetch_assoc($result1))!=null){
    var_dump(6666);
    $sql="UPDATE $u1 SET number = (number+$n1) where name='$name1' AND size='$s1'";
    $result=mysqli_query($link,$sql);
}else{
    var_dump(1111);
    $sql="insert into $u1(user,img,name,price,number,size,xzk) values('$u1','$img1','$name1','$p1','$n1','$s1','$x1')";
    $result=mysqli_query($link,$sql);
}
//关闭数据库连接
mysqli_close($link);

?>